package metier.Service;

import java.util.List;

import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;

import metier.entities.Pays;
import metier.entities.SubCategorie;
import metier.entities.categorie;
import metier.sess.ISubCategorieLocal;



@Stateless
@WebService
public class SubCategorieService {
	@EJB(beanName="SubCategorie")
	private ISubCategorieLocal metier;
	
	
	@WebMethod
	public void addSubCategorie(@WebParam(name="Intitule")String Initule,@WebParam(name="Statut")boolean statut,@WebParam(name="categorie")categorie categorie)
	{
		SubCategorie sb=new SubCategorie(Initule,statut,categorie);
		metier.addSubCategorie(sb);
	}
	
	
	@WebMethod
	public List<SubCategorie> listSubCategories()
	{
		return metier.getAllSubCategories();
	}
	
	@WebMethod 
	public SubCategorie getSubCategorie(@WebParam(name="Id")Integer Id)
	{
		return metier.getSubCategorie(Id);
	}
	
	
	@WebMethod
	public void UpdateSubCategorie(@WebParam(name="Id")Integer Id,@WebParam(name="Intitule")String Initule,@WebParam(name="Statut")boolean statut)
	{
	
		SubCategorie sb=metier.getSubCategorie(Id);
		sb.setIntitule(Initule);
		sb.setStatut(statut);
		metier.updateSubCategories(sb);
		
	}
	
	
	@WebMethod
	public void DeleteSubCategorie(@WebParam(name="Id")Integer Id)
	{
		metier.deleteSubCategorie(Id);
	}
	

}
